package com.rainbow.validate

import java.io.Serializable
import java.time.LocalDateTime

/**
 *rainbow
 */
open class ValidateCode : Serializable {

    var code: String? = null

    var expireTime: LocalDateTime? = null

    constructor(code: String, expireIn: Long) {
        this.code = code
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn)
    }

    constructor(code: String, expireTime: LocalDateTime) {
        this.code = code
        this.expireTime = expireTime
    }

    fun isExpired(): Boolean {
        return LocalDateTime.now().isAfter(expireTime)
    }
}